package com.cskaoyan.controller.wx;

import com.cskaoyan.bean.MarketComment;
import com.cskaoyan.model.admin.vo.BaseDataListVo;
import com.cskaoyan.model.admin.vo.BaseRespVo;
import com.cskaoyan.model.vx.bo.WxCommentPostBo;
import com.cskaoyan.model.vx.vo.WxCommentCountVo;
import com.cskaoyan.service.wx.WxCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

/**
 * @author hanshuai
 * @version 1.0
 * @description @TODO
 * @date 2021/12/2 15:02
 */
@RestController
@RequestMapping("wx/comment")
public class WxCommentController {
    @Autowired
    WxCommentService wxCommentService;

    @RequestMapping("/list")
    public BaseRespVo commentList(Integer page, Integer limit, Integer valueId, Byte type, Boolean showType, HttpSession httpSession) {
        BaseDataListVo baseDataListVo = wxCommentService.commentList(page, limit, valueId, type, showType,httpSession);
        return BaseRespVo.ok(baseDataListVo);
    }

    @RequestMapping("/post")
    public BaseRespVo commentPost(@RequestBody WxCommentPostBo WxCommentPostBo,HttpSession httpSession) {
        MarketComment marketComment1 = wxCommentService.commentPost(WxCommentPostBo,httpSession);
        return BaseRespVo.ok(marketComment1);
    }

    @RequestMapping("/count")
    public BaseRespVo commentCount(Integer valueId, Byte type) {
        WxCommentCountVo wxCommentCountVo = wxCommentService.commentCount(valueId, type);
        return BaseRespVo.ok(wxCommentCountVo);
    }
}
